#文件变序
import random

file01 = open("Unit1_P1_en.txt", encoding="utf-8")
file02 = open("Unit1_P1_ch.txt", encoding="utf-8")
file03 = open("answer.txt", encoding="utf-8")

file_1 = open("EN.txt", "w", encoding="utf-8")
file_2 = open("CH.txt", "w", encoding="utf-8")
file_3 = open("ANS.txt", "w", encoding="utf-8")


L1 = []
L2 = []
L3 = []

for i in file01.readlines():
    L1.append(i)
for i in file02.readlines():
    L2.append(i)
for i in file03.readlines():
    L3.append(i)

for i in range(218):
    random_list = random.randint(0, len(L1)-1)
    file_1.write(L1.pop(random_list))
    file_2.write(L2.pop(random_list))
    file_3.write(L3.pop(random_list))

file_1.close()
file_2.close()
file_3.close()
    
